package com.gouqi.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gouqi.common.DeleteRequest;
import com.gouqi.model.dto.userAnswer.UserAnswerAddRequest;
import com.gouqi.model.dto.userAnswer.UserAnswerEditRequest;
import com.gouqi.model.dto.userAnswer.UserAnswerQueryRequest;
import com.gouqi.model.dto.userAnswer.UserAnswerUpdateRequest;
import com.gouqi.model.entity.UserAnswer;
import com.gouqi.model.vo.UserAnswerVO;

import javax.servlet.http.HttpServletRequest;

public interface UserAnswerService extends IService<UserAnswer> {
    /**
     * 校验数据
     *
     * @param userAnswer
     * @param add        对创建的数据进行校验
     */
    void validUserAnswer(UserAnswer userAnswer, boolean add);

    /**
     * 获取查询条件
     *
     * @param userAnswerQueryRequest
     * @return
     */
    LambdaQueryWrapper<UserAnswer> getQueryWrapper(UserAnswerQueryRequest userAnswerQueryRequest);

    /**
     * 获取用户答案封装
     *
     * @param userAnswer
     * @param request
     * @return
     */
    UserAnswerVO getUserAnswerVO(UserAnswer userAnswer, HttpServletRequest request);

    /**
     * 分页获取用户答案封装
     *
     * @param userAnswerPage
     * @param request
     * @return
     */
    Page<UserAnswerVO> getUserAnswerVOPage(Page<UserAnswer> userAnswerPage, HttpServletRequest request);

    /**
     * 创建用户答案
     *
     * @param userAnswerAddRequest
     * @param request
     * @return
     */
    long addUserAnswer(UserAnswerAddRequest userAnswerAddRequest, HttpServletRequest request);

    /**
     * 编辑用户答案（用户使用）
     *
     * @param userAnswerEditRequest
     * @param request
     */
    void editUserAnswer(UserAnswerEditRequest userAnswerEditRequest, HttpServletRequest request);

    /**
     * 分页获取当前登录用户创建的用户答案列表
     *
     * @param userAnswerQueryRequest
     * @param request
     * @return
     */
    Page<UserAnswerVO> getMyUserAnswerVOPage(UserAnswerQueryRequest userAnswerQueryRequest, HttpServletRequest request);

    /**
     * 分页获取用户答案列表（封装类）
     *
     * @param userAnswerQueryRequest
     * @param request
     * @return
     */
    Page<UserAnswerVO> getUserAnswerPage(UserAnswerQueryRequest userAnswerQueryRequest, HttpServletRequest request);

    /**
     * 分页获取用户答案列表（仅管理员可用）
     *
     * @param userAnswerQueryRequest
     * @return
     */
    Page<UserAnswer> getUserAnswerListPage(UserAnswerQueryRequest userAnswerQueryRequest);

    /**
     * 删除用户答案
     *
     * @param deleteRequest
     * @param request
     */
    void deleteUserAnswer(DeleteRequest deleteRequest, HttpServletRequest request);

    /**
     * 根据 id 获取用户答案（封装类）
     * @param id
     * @param request
     * @return
     */
    UserAnswerVO getUserAnswer(long id, HttpServletRequest request);

    /**
     * 更新用户答案（仅管理员可用）
     * @param userAnswerUpdateRequest
     */
    void updateUserAnswer(UserAnswerUpdateRequest userAnswerUpdateRequest);

}
